import fetch from '../utils/fetch';
import axios from 'axios';
let base = 'http://www.jackhoo.cn';
//let base = 'http://localhost:8848';

export function getLiveTypes (orgId) {
    return fetch({
        url: '/live_type/list/'+orgId,
        method: 'get'
    })
}
export function addLiveType(typeInfo) {
    return fetch({
        url: '/live_type',
        method: 'post',
        data:typeInfo
    })
}

/**
 * 获取七牛云上传token
 * @returns {*}
 */
export function getQiNiuToken() {
    return fetch({
        url: '/qiniu_token',
        method: 'get',

    })
}
/**
 * 创建直播活动
 * @param liveEventInfo
 * @returns {*}
 */
export function createLiveRoom(liveRoomInfo) {
    return fetch({
        url: '/live_room/create',
        method: 'post',
        data:liveRoomInfo
    })
}
export function updateLiveRoom(liveRoomInfo) {
    return fetch({
        url: '/live_room',
        method: 'put',
        data: liveRoomInfo
    })
}
/**
 * 获取机构直播活动列表
 * @param params
 * @returns {*}
 */
export function getOrgLiveList(orgId,params) {
    return fetch({
        url: '/live_room/list/'+orgId ,
        method: 'get',
        params:params
    })
}
/**
 *
 */
export function getOneLiveInfoById(liveRoomId) {
    return fetch({
        url: '/live_room/info/'+liveRoomId,
        method: 'get'
    })
}
export function addHost(hostInfo) {
    return fetch({
        url: '/cus_host/add',
        method: 'post',
        data: hostInfo
    })
}
export function getHostList(params) {
    return fetch({
        url: '/cus_host',
        method: 'get',
        params:params
    })
}
export function getHostByLiveRoomId(liveRoomId) {
    return fetch({
        url: '/cus_host/live_room/'+liveRoomId,
        method: 'get'
    })
}
export function updateHost(hostInfo) {
    return fetch({
        url: '/cus_host',
        method: 'put',
        data: hostInfo
    })
}
export function resetPassword(params) {
    return fetch({
        url: '/cus_principal/reset_pwd',
        method: 'get',
        params:params
    })
}
export function deleteHost(hostId) {
    return fetch({
        url: '/cus_host/'+hostId,
        method: 'delete'
    })
}
export function exportCvs(orgId) {
    return fetch({
        url: '/cus_host/export_cvs/'+orgId,
        method: 'get'
    })
}
export function addLiveRoomTab(tabInfo) {
    return fetch({
        url: '/live_room_tab',
        method: 'post',
        data: tabInfo
    })
}
export function getLiveRoomTabs(roomId) {
    return fetch({
        url: '/live_room_tab/'+roomId,
        method: 'get'
    })
}
export function updateLiveRoomTab(tabInfo) {
    return fetch({
        url: '/live_room_tab',
        method: 'put',
        data: tabInfo
    })
}
export function updateLiveRoomDesc(roomDesc) {
    return fetch({
        url: '/live_room/desc',
        method: 'put',
        data: roomDesc
    })
}
export function deleteLiveRoomTab(tabId) {
    return fetch({
        url: '/live_room_tab',
        method: 'delete',
        params: tabId
    })
}
export function addGuideUrl(info) {
    return fetch({
        url: '/live_ad_page',
        method: 'post',
        data: info
    })
}
export function getGuideUrlByLiveRoomId(roomId) {
    return fetch({
        url: '/live_ad_page/guide_page/'+roomId,
        method: 'get'
    })
}
export function updateGuideUrl(info) {
    return fetch({
        url: '/live_ad_page',
        method: 'put',
        data: info
    })
}
export function deleteAdPage(id) {
    return fetch({
        url: '/live_ad_page/'+id,
        method: 'delete',
    })
}
export function getQrCode(url) {
    return fetch({
        url: '/api/qr_code',
        method: 'get',
        params: {
            url:url
        }
    })
}
export function deleteLiveRoom(liveRoomIds) {
    return fetch({
        url: '/live_room',
        method: 'delete',
        data: liveRoomIds
    })
}
export function getReplayUrls(params) {
    return fetch({
        url: '/live_record',
        method: 'get',
        params: params
    })
}
export function deleteReplayVideo(ids) {
    return fetch({
        url: '/live_record',
        method: 'delete',
        data: ids
    })
}
export function getCommentsByLiveRoomId(params) {
    return fetch({
        url: '/live_room_comment',
        method: 'get',
        params: params
    })
}
export function deleteComments(ids) {
    return fetch({
        url: '/live_room_comment',
        method: 'delete',
        data: ids
    })
}
export function getCountOfComments(liveRoomId) {
    return fetch({
        url: '/live_room_comment/stat/'+liveRoomId,
        method: 'get'
    })
}
export function sendMsgToChatRoom(msg) {
    return fetch({
        url: '/rong_cloud/send_admin_msg',
        method: 'post',
        data: msg
    })
}
export function addViewCode(e) {
    return fetch({
        url: '/live_room_view_code',
        method: 'post',
        data: e
    })
}
export function deleteViewCode(id) {
    return fetch({
        url: '/live_room_view_code/'+id,
        method: 'delete'
    })
}
export function updateViewCode(e) {
    return fetch({
        url: '/live_room_view_code',
        method: 'put',
        data: e
    })
}
export function getViewCode(id) {
    return fetch({
        url: '/live_room_view_code/code/'+id,
        method: 'get'
    })
}